package com.zhs.gccs.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhs.gccs.R;
import com.zhs.gccs.vo.AdminTaskBean;

import java.util.List;

/**
 * Created by chengzf on 2024/7/20.
 */
public class AdminGccsTaskListAdapter extends BaseQuickAdapter<AdminTaskBean, BaseViewHolder>{


    public AdminGccsTaskListAdapter() {
        super(R.layout.item_admin_task_view);
    }

    @Override
    protected void convertPayloads(@NonNull BaseViewHolder helper, AdminTaskBean item, @NonNull List<Object> payloads) {
        super.convertPayloads(helper, item, payloads);
        ImageView iv_check = helper.getView(R.id.iv_check);

        if (item.isIcCheck()){
            iv_check.setImageResource(R.mipmap.checkbox_checked);
        }else {
            iv_check.setImageResource(R.mipmap.checkbox_uncheck);
        }
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, AdminTaskBean bean) {

        ImageView iv_check = holder.getView(R.id.iv_check);

        if (bean.isIcCheck()){
            iv_check.setImageResource(R.mipmap.checkbox_checked);
        }else {
            iv_check.setImageResource(R.mipmap.checkbox_uncheck);
        }
        holder.setText(R.id.tv_task_name, bean.getXmmc());

        holder.setGone(R.id.view_flag, holder.getBindingAdapterPosition() != mData.size() - 1);

    }
}
